﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.抽象工厂模式
{
    public class ColorFactory:AbstractFactory
    {
        public override IShape GetShape(string shapeType)
        {
            return null;
        }

        public override IColor GetColor(string colorType)
        {
            if (colorType == null)
            {
                return null;
            }
            else if (colorType.Equals("red", StringComparison.InvariantCultureIgnoreCase))
            {
                return new Red();
            }
            else if (colorType.Equals("green", StringComparison.InvariantCultureIgnoreCase))
            {
                return new Green();
            }
            else if (colorType.Equals("blue", StringComparison.InvariantCultureIgnoreCase))
            {
                return new Blue();
            }
            else
            {
                return null;
            }
        }
    }
}
